package com.silence.whereeat.utils;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;

import java.io.IOException;

/**
 * httpClientGet
 * Created by 伟阳 on 2015/9/16.
 */
public class HttpClientGet {
    private String URL_PATH = "";

    public HttpClientGet(String urlPath) {
        this.URL_PATH = urlPath;
    }

    public String getLoginResult() {
        String result = "";
        HttpClient client = new DefaultHttpClient();
        HttpGet httpGet = new HttpGet(URL_PATH);
        try {
            HttpResponse response = client.execute(httpGet);
            result = EntityUtils.toString(response.getEntity());
        } catch (IOException e) {
            e.printStackTrace();
        }
        return result;
    }
}
